﻿@inject IFileUploadService _fileUploadService

<div class="@Class">
    <CnGalWebSite.Components.Buttons.MasaButton Text="转存图片并整理格式" IsAsync="true" OnClick="OnClick" Icon="mdi-transit-connection-variant" Rounded/>
</div>

@code {
    [Parameter]
    public string Class { get; set; }
    [Parameter]
    public string Text { get; set; }
    [Parameter]
    public EventCallback<string> TextChanged { get; set; }

    [CascadingParameter]
    public ErrorHandler ErrorHandler { get; set; }

    public async Task OnClick()
    {
        var model =await _fileUploadService.TransformImagesAsync(Text);
        Text = model.Text;
        await TextChanged.InvokeAsync(Text);
    }

}
